
cmake_minimum_required(VERSION 3.15)

set(command "C:/Users/27843/.vcpkg/artifacts/2139c4c6/tools.kitware.cmake/3.28.4/bin/cmake.exe;-G;Ninja;-S;C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/stdPrj+Target_1;-B;C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/1;-DSOLUTION_ROOT=C:/project/jutu-course-code-warehouse/3.gpio_interrpt;-DCMSIS_PACK_ROOT=C:/Users/27843/AppData/Local/Arm/Packs;-DCMSIS_COMPILER_ROOT=C:/Users/27843/.vcpkg/artifacts/2139c4c6/tools.open.cmsis.pack.cmsis.toolbox/2.6.1/etc")
set(log_merged "")
set(log_output_on_failure "ON")
set(stdout_log "C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/stdPrj+Target_1/src/stdPrj+Target_1-stamp/stdPrj+Target_1-configure-out.log")
set(stderr_log "C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/stdPrj+Target_1/src/stdPrj+Target_1-stamp/stdPrj+Target_1-configure-err.log")
execute_process(
  COMMAND ${command}
  RESULT_VARIABLE result
  OUTPUT_FILE "${stdout_log}"
  ERROR_FILE "${stderr_log}"
)
macro(read_up_to_max_size log_file output_var)
  file(SIZE ${log_file} determined_size)
  set(max_size 10240)
  if (determined_size GREATER max_size)
    math(EXPR seek_position "${determined_size} - ${max_size}")
    file(READ ${log_file} ${output_var} OFFSET ${seek_position})
    set(${output_var} "...skipping to end...\n${${output_var}}")
  else()
    file(READ ${log_file} ${output_var})
  endif()
endmacro()
if(result)
  set(msg "Command failed: ${result}\n")
  foreach(arg IN LISTS command)
    set(msg "${msg} '${arg}'")
  endforeach()
  if (${log_merged})
    set(msg "${msg}\nSee also\n  ${stderr_log}")
  else()
    set(msg "${msg}\nSee also\n  C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/stdPrj+Target_1/src/stdPrj+Target_1-stamp/stdPrj+Target_1-configure-*.log")
  endif()
  if (${log_output_on_failure})
    message(SEND_ERROR "${msg}")
    if (${log_merged})
      read_up_to_max_size("${stderr_log}" error_log_contents)
      message(STATUS "Log output is:\n${error_log_contents}")
    else()
      read_up_to_max_size("${stdout_log}" out_log_contents)
      read_up_to_max_size("${stderr_log}" err_log_contents)
      message(STATUS "stdout output is:\n${out_log_contents}")
      message(STATUS "stderr output is:\n${err_log_contents}")
    endif()
    message(FATAL_ERROR "Stopping after outputting logs.")
  else()
    message(FATAL_ERROR "${msg}")
  endif()
else()
  if(NOT "Ninja" MATCHES "Ninja")
    set(msg "stdPrj+Target_1 configure command succeeded.  See also C:/project/jutu-course-code-warehouse/3.gpio_interrpt/tmp/stdPrj+Target_1/src/stdPrj+Target_1-stamp/stdPrj+Target_1-configure-*.log")
    message(STATUS "${msg}")
  endif()
endif()
